/**
 * 
 */
package setup;

import java.util.List;

import jpa_objects.Branch;
import jpa_objects.Business;
import jpa_objects.Business_type;
import jpa_objects.City;
import jpa_objects.Comment;
import jpa_objects.Discount;
import jpa_objects.Event;
import jpa_objects.Event_report;
import jpa_objects.Event_suggestion;
import jpa_objects.Feedback;
import jpa_objects.Instructor;
import jpa_objects.Instructor_type;
import jpa_objects.Message;
import jpa_objects.Notification;
import jpa_objects.Player;
import jpa_objects.User_report;
import jpa_objects.Review;
import jpa_objects.Sport;
import jpa_objects.Sport_calification;
import jpa_objects.User;
import logic.CluviePlayer;

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

import persistence.DBCommonAlter;
import persistence.DBCommonConsult;



/**
 * @author Alejandro Casas
 *
 */
public class DBBuilder {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		AnnotationConfiguration conf= new AnnotationConfiguration();
		
		conf.addAnnotatedClass(Branch.class);
		conf.addAnnotatedClass(Business_type.class);
		conf.addAnnotatedClass(Business.class);
		conf.addAnnotatedClass(City.class);
		conf.addAnnotatedClass(Comment.class);
		conf.addAnnotatedClass(Discount.class);
		conf.addAnnotatedClass(Event_report.class);
		conf.addAnnotatedClass(Event_suggestion.class);
		conf.addAnnotatedClass(Event.class);
		conf.addAnnotatedClass(Feedback.class);
		conf.addAnnotatedClass(Instructor_type.class);
		conf.addAnnotatedClass(Instructor.class);
		conf.addAnnotatedClass(Message.class);
		conf.addAnnotatedClass(Notification.class);
		conf.addAnnotatedClass(Player.class);
		conf.addAnnotatedClass(Review.class);
		conf.addAnnotatedClass(Sport_calification.class);
		conf.addAnnotatedClass(Sport.class);
		conf.addAnnotatedClass(User_report.class);
		conf.addAnnotatedClass(User.class);
		
		
		conf.configure();
		//new SchemaExport(conf).create(true, true);
		//dbConsult dbc=dbConsult.darIns();
		//ArrayList<Cluvie_User> users=dbc.SearchUsers("");
		
		/*Business b=new Business("", "Colombia", "", "", "b@b.com", "", "empresa", 0, "", "", "", 0, "", "", false, "", 0, 0, "", new Business_type("type"), new City("Bogota", "Colombia"));
		(new DBCommonAlter()).saveUser(b, DBCommonAlter.SAVE_USER);
		
	
		Player p=new Player("", "Colombia", "", "", "alejo@a.a", "", "alejandro", 0, "", "", "", 0, "", false, "", "", false, "", new City("Bogota", "Colombia"), "male");
		List<Sport>s=p.getSports_of_interest();
		s.add(new Sport("Tennis"));
		s.add(new Sport("Golf"));
		p.setSports_of_interest(s);
		(new DBCommonAlter()).saveUser(p, DBCommonAlter.SAVE_USER);
	
		//Instructor i=new Instructor("", "Colombia", "", "", "a.casas401@gmail.com", "", "nombre1", 0, "", "", "", 0, "", 0, "", false, "", "male", new Instructor_type(Instructor_type.PERSONAL_TRAINER), new City("Bogota", "Colombia"));
		s=i.getSports_of_interest();
		s.add(new Sport("Tennis"));
		s.add(new Sport("Golf"));
		i.setSports_of_interest(s);
		(new DBCommonAlter()).saveUser(i, DBCommonAlter.SAVE_USER);
		//Instructor i1=new Instructor("", "Colombia", "", "", "a.casas402@gmail.com", "", "nombre2", 0, "", "", "", 0, "", 0, "", false, "", "male", new Instructor_type(Instructor_type.PERSONAL_TRAINER), new City("Bogota", "Colombia"));
		s=i1.getSports_of_interest();
		s.add(new Sport("Tennis"));
		//s.add(new Sport("Golf"));
		i1.setSports_of_interest(s);
		(new DBCommonAlter()).saveUser(i1, DBCommonAlter.SAVE_USER);
		//Instructor i2=new Instructor("", "Colombia", "", "", "a.casas403@gmail.com", "", "nombre3", 0, "", "", "", 0, "", 0, "", false, "", "male", new Instructor_type(Instructor_type.PERSONAL_TRAINER), new City("Bogota", "Colombia"));
		s=i2.getSports_of_interest();
		//s.add(new Sport("Tennis"));
		s.add(new Sport("Soccer"));
		i2.setSports_of_interest(s);
		(new DBCommonAlter()).saveUser(i2, DBCommonAlter.SAVE_USER);
		
		*/
		//System.out.println("User: "+(new DBCommonConsult()).getUser("alejoyjilete_casas@hotmail.com", DBCommonConsult.LAZY).getMail());
		//Player p=(new DBCommonConsult()).getPlayer("a.casas@cluvie.com");
		//(new CluviePlayer()).setPlayerAvailable("p4@p.pp", "", "", false, "Soccer", 0, 0, "Colombia", "Bogota");
		//System.out.println("Business: "+(new DBCommonConsult()).getBusiness("a.casas@cluvie.com").getMail());
		/*
		List<Instructor> r=(new DBCommonConsult()).getCoaches("a_a@a.com","Tennis", "Bogota", "Colombia", false);
		for (Instructor in: r) {
			System.out.println(in.getMail());
		}
		*/
		
	}

}
